import { arJson, deJson, enJson, esJson, frJson, itJson, ptJson, zhJson } from '@/lang/timeZone';
import { COMMON_DST_OPTIONS } from '@/constant/timeZone';
export default {
    methods: {
        getTimeZoneTr(lang, needTrJson = COMMON_DST_OPTIONS) {
            try {
                const timeZonesMap = new Map([
                    ['de', deJson],
                    ['en', enJson],
                    ['es', esJson],
                    ['fr', frJson],
                    ['it', itJson],
                    ['pt', ptJson],
                    ['zh', zhJson],
                    ['ar', arJson]
                ]);
                const idsRes = timeZonesMap.get(lang);
                const finishTrJson = needTrJson.map((item) => {
                    const findItem = idsRes.find((idTrItem) => idTrItem.id === item.id);
                    if (findItem) {
                        return {
                            id: findItem.id,
                            idTr: findItem.idTr,
                            value: item.id === findItem.id ? item.value : findItem.id
                        };
                    } else {
                        return {
                            id: item.id,
                            idTr: item.id,
                            value: item.id
                        };
                    }
                });
                return finishTrJson;
            } catch (error) {
                return needTrJson;
            }
        }
    }
};
